import 'package:flutter/material.dart';
import '../models/todo.dart';

class TodoItem extends StatelessWidget {
  final Todo todo;
  final Function toggleStatus;

  TodoItem({required this.todo, required this.toggleStatus});

  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Text(todo.title,
          style: TextStyle(
            decoration:
                todo.isDone ? TextDecoration.lineThrough : TextDecoration.none,
          )),
      trailing: Checkbox(
        value: todo.isDone,
        onChanged: (value) {
          toggleStatus();
        },
      ),
    );
  }
}